package com.health.work.activity;

import com.health.work.R;
import com.health.work.utils.AsyncImageLoader;

import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;
import android.widget.Toast;

public class BigImageActivity extends Activity{
	
	private String picName;
	private AsyncImageLoader asyncImageLoader;
	public void onCreate(Bundle savedInstanceState) {
		  super.onCreate(savedInstanceState);
		  requestWindowFeature(Window.FEATURE_NO_TITLE);
		  setContentView(R.layout.dialog_photo_entry);
		  Bundle bundle = this.getIntent().getExtras();
		  if(bundle!=null){
		   picName = bundle.getString("picName"); //图片名
		  }
		  ImageView img = (ImageView)this.findViewById(R.id.large_image );
//		  imageDownloader.download( picName,img);
		  asyncImageLoader = new AsyncImageLoader();
		  Drawable drawable = asyncImageLoader
					.loadImageFromUrl(picName);
			if (drawable != null) {
				img.setImageDrawable(drawable);
			} else {
				img.setImageResource(R.drawable.nophoto);
			}
		  Toast toast = Toast.makeText(this, "点击图片即可返回",Toast.LENGTH_SHORT);
		  toast.setGravity(Gravity.BOTTOM, 0, 0);
		  toast.show();
		  img.setOnClickListener(new View.OnClickListener() { // 点击返回
		   public void onClick(View paramView) {
			   BigImageActivity.this.finish();
		   }
		  });
		 }
}
